﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel;
using Code.BLL;
using System.Web.Mvc;
using System.ComponentModel.DataAnnotations;
using QianBuo.Lottery.Web.Models.User;
using Code.Models;
using QianBuo.Lottery.Web.Models;

namespace QianBuo.Lottery.Web.Areas.Manage.Models.User
{
    [Serializable]
    public class DeleteModel
    {
        /// <summary>
        /// 要删除的用户名
        /// </summary>
        [DisplayName("要删除的用户名")]
        [Required]
        public string UserName { get; set; }
        /// <summary>
        /// 删除类型，1为删除指定用户，2为删除无账变用户
        /// </summary>
        public short DeleteType { get; set; }
        /// <summary>
        /// 要搜索至今没有交易记录的起始日期
        /// </summary>
        [DisplayName("起始日期")]
        [DataType(DataType.Date,ErrorMessage="格式不正确")]
        public DateTime? StartTime { get; set; }
        /// <summary>
        /// 根据金额来搜索用户的最小总金额(包括余额,冻结金额)
        /// </summary>
        [DisplayName("最小金额")]
        [Range(0,1000000000000,ErrorMessage="格式不正确")]
        public double? MinMoney { get; set; }
        /// <summary>
        /// 搜索的结果
        /// </summary>
        public List<User_Comm> SeachResult { get; set; }
        /// <summary>
        /// 共同的上级
        /// </summary>
        public List<User_Comm> CommCommand { get; set; }
    }

    [Serializable]
    public class ChageModel
    {
        /// <summary>
        /// 当前用户ID
        /// </summary>
        public Guid ID { get; set; }
        public User_Comm User { get; set; }
        public Guid? CommandID { get; set; }
        public IEnumerable<SelectListItem> Commands { get; set; }
    }

    [Serializable]
    public class DisposeModel
    {
        public long ID { get; set; }
        public User_Comm User { get; set; }
        public double TakeMoney { get; set; }
        public double Balance { get; set; }
        public DateTime AddTime { get; set; }
        public TakeMoneyState State { get; set; }
        public string Remark { get; set; }
        public string BankName { get; set; }
        public string BankCardNo { get; set; }
        public string BankProviecs { get; set; }
        public string CityName { get; set; }
        public string StreetName { get; set; }
        public string QQ { get; set; }
        public string Tel { get; set; }
        public string PayAccount { get; set; }
        public BankType Type { get; set; }
        public string Account { get; set; }
        public string OperatorName { get; set; }
    }

    [Serializable]
    public class Manage_DetailModel
    {
        public string Uid { get; set; }
        [RegularExpression(@"^.{6,12}$",ErrorMessage="格式不正确")]
        public string LoginPwd { get; set; }
        [RegularExpression(@"^.{6,12}$", ErrorMessage = "格式不正确")]
        public string TakePwd { get; set; }
        public Manage_UserDetail Detail { get; set; }
        public Code.Models.Account Accout { get; set; }
        public DateTime RegestTime { get; set; }

        public Manage_UserDetail OldDetail { get; set; }
    }
    [Serializable]
    public class UpdateMoneyModel
    {
        /// <summary>
        /// 要修改的用户的编号
        /// </summary>
        public string Uid { get; set; }
        /// <summary>
        /// 修改前的余额
        /// </summary>
        public double OldBalance { get; set; }
        /// <summary>
        /// 修改前的冻结金额
        /// </summary>
        public double OldFreezeMoney { get; set; }
        /// <summary>
        /// 修改后的余额
        /// </summary>
        [Range(0, double.MaxValue, ErrorMessage = "*")]
        public double NewBalance { get; set; }
        /// <summary>
        /// 修改后的冻结金额
        /// </summary>
        [Range(0, double.MaxValue, ErrorMessage = "*")]
        public double NewFreezeMoney { get; set; }
    }
    public class Manage_UserDetail
    {
        public Guid UserID { get; set; }

        [DisplayName("用户名:")]
        public string LoginName
        { get; set; }

        [DisplayName("QQ:")]
        [RegularExpression(@"^\d{5,20}$", ErrorMessage = "格式不正确")]
        public string QQ
        { get; set; }

        [DisplayName("Email:")]
        [RegularExpression(@"^[a-zA-Z0-9]+@[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$", ErrorMessage = "格式不正确")]
        public string Email { get; set; }

        [RegularExpression(@"^\d+-?\d+$", ErrorMessage = "格式不正确")]
        [DisplayName("电话")]
        public string Tel { get; set; }
        /// <summary>
        /// 开户银行
        /// </summary>
        [DisplayName("开户银行:")]
        public int? BankID
        { get; set; }
        /// <summary>
        /// 开户城市
        /// </summary>
        [DisplayName("开户城市")]
        [DataType(DataType.Custom, ErrorMessage = "请选择开户城市")]
        public int? BankCityID { get; set; }


        /// <summary>
        /// 街道名称
        /// </summary>
        [DisplayName("银行详情/街道")]
        public string BankStreetName { get; set; }

        /// <summary>
        /// 银行卡号
        /// </summary>
        [DisplayName("银行卡号:")]
        //[RegularExpression(@"^\d{15,25}$", ErrorMessage = "格式不正确")]
        public string BankCardNo{ get; set; }


        /// <summary>
        /// 其它支付账号
        /// </summary>
        [DisplayName("网上支付账号:")]
        public string PayAccount { get; set; }

        /// <summary>
        /// 真实姓名
        /// </summary>
        [DisplayName("真实姓名:")]
        public string Name
        { get; set; }
        /// <summary>
        /// 登录密码
        /// </summary>
        [DisplayName("登录密码:")]
        [DataType(DataType.Password)]
        public string LoginPwd
        { get; set; }

        /// <summary>
        /// 状态
        /// </summary>
        [Required(ErrorMessage = "*")]
        public short? State { get; set; }
        /// <summary>
        ///  用户类型
        /// </summary>
        [Required(ErrorMessage = "*")]
        public short? UserType { get; set; }


        /// <summary>
        /// 是否有锁定
        /// </summary>
        public bool Locked
        { get; set; }

    }

    [Serializable]
    public class AddMoneyModel
    {
        [Required(ErrorMessage="*")]
        public string UserName { get; set; }
        [DataType(DataType.Currency,ErrorMessage="*")]
        [Required(ErrorMessage="*")]
        public double? Money { get; set; }
    }

    [Serializable]
    public class TransferAccountModel
    {
        public TransferAccountSerchModel Serch { get; set; }
        public IEnumerable<TransferAccountItem> Datas { get; set; }
        public int? Page { get; set; }
        public int? PageSize { get; set; }
        public int SumCount { get; set; }
        [Range(0L, long.MaxValue, ErrorMessage = "*")]
        public long? OrderID { get; set; }
        public double? ChargeRatio { get; set; }
        public double? MinRatio { get; set; }
        public double? MaxRatio { get; set; }
        public List<SelectListItem> Results { get; set; }
    }

    [Serializable]
    public class TransferAccountSerchModel
    {
        public long? Order { get; set; }
        public PayResult? Result { get; set; }
        public string UserName { get; set; }
        public string SiteID { get; set; }
        public DateTime? StartTime { get; set; }
        public DateTime? EndTime { get; set; }
    }

    [Serializable]
    public class TransferAccountItem
    {
        public Guid ID { get; set; }
        public long OrderID { get; set; }
        public string UserName { get; set; }
        public DateTime AddTime { get; set; }
        public DateTime? SuccesTime { get; set; }
        public double Money { get; set; }
        public PayResult Result { get; set; }
        public Guid UserID { get; set; }
        public string Admin { get; set; }
        public string SiteID { get; set; }
    }

}